#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 3e3 + 10;
const int M = 1e4 + 10;
const ull base = 19491001;
struct edge { int v, nxt; } e[M << 1];
int h[N], n, m, cnt = 1, bel[N], scc, stk[N], low[N], dfn[N], top, tim, tbel[N];
void link(int x, int y) { e[++cnt] = (edge) { y, h[x] }; h[x] = cnt; }
ull res[N];
bool ban[M];

void tarjan(int x, int lst) {
	stk[++top] = x; low[x] = dfn[x] = ++tim;
	for(int i = h[x], y = e[i].v; i; i = e[i].nxt, y = e[i].v)
		if(!ban[i] && (i ^ 1) != lst) {
			if(low[y]) chkmin(low[x], dfn[y]);
			else tarjan(y, i), chkmin(low[x], low[y]);
		}
	if(low[x] == dfn[x]) { ++scc; int y; do { y = stk[top--]; bel[y] = scc; } while(y ^ x);	}
}

void runit() {
	scc = tim = top = 0; rep(i, 1, n) low[i] = dfn[i] = stk[i] = 0;
	rep(i, 1, n) if(!low[i]) tarjan(i, -1);
	rep(i, 1, n) res[i] = res[i] * base + bel[i];
}

int fa[N];
int gf(int x) { return x == fa[x] ? x : fa[x] = gf(fa[x]); }

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	n = in, m = in;
	rep(i, 1, n) fa[i] = i;
	rep(i, 1, m) { int u = in, v = in; link(u, v); link(v, u); fa[gf(u)] = gf(v); }
	runit(); rep(i, 1, n) tbel[i] = bel[i];
	rep(i, 1, m) ban[i * 2] = ban[i * 2 + 1] = true, runit(), ban[i * 2] = ban[i * 2 + 1] = false;
	int ans = 0;
	rep(i, 1, n)
		rep(j, i + 1, n) {
		int res = 0;
		if(gf(i) != gf(j)) res = 0;
		else if(tbel[i] != tbel[j]) res = 1;
		else if(::res[i] != ::res[j]) res = 2;
		else res = 3;
		ans += res;
	}
	printf("%d\n", ans);
	return 0;
}
